function chg(){
    let bodybgcolor=document.body.className;
    if(bodybgcolor=="body"){
        document.body.className="body2";
    }else if(bodybgcolor=="body3"){
        document.body.className="body";
    }else{
        document.body.className="body3";
    }
}
function calArea(e){
    switch(e){
        case 1:
            let r=prompt("请输入圆的半径")
            document.getElementById("info").innerHTML="<h2>r="+r+"<br>s="+Math.PI*r*r+"</h2>";
            break;
        case 2:
            let b=prompt("请输入三角形的底边");
            let h=prompt("请输入三角形的高");
            document.getElementById("info").innerHTML="<h2>b="+b+"<br>h="+h+"<br>s="+0.5*b*h+"</h2>";
            break;
        case 3:
            let a=prompt("请输入长方形的长");
            let g=prompt("请输入长方形的宽");
            document.getElementById("info").innerHTML="<h2>a="+a+"<br>g="+g+"<br>s="+a*g+"</h2>";
            break;
        default:
            alert("没有");
    }
}

let t;
function pic(e){
    let p=document.getElementById("img");
    let co=document.querySelectorAll(".diva");
    let n=e;
    //死循环
      t=setInterval(function(){
            if(co[n]=co[1]){
                co[0].style="background-color: white;";
            }
            if(co[n]=co[2]){
                co[1].style="background-color: white;";
            }
            if(co[n]=co[3]){
                co[2].style="background-color: white;";
            }
            if(co[n]=co[4]){
                co[3].style="background-color: white;";
            }
            if(co[n]=co[5]){
                co[4].style="background-color: white;";
            }
            if(co[n]=co[0]){
                co[5].style="background-color: white;";
            }
            if(n==6){
                n=5;
            }
            n++;
            co[n-1].style="background-color: darkgray;";
            p.src="../images/q0"+n+".jpg";
           
            if(co[n]==co[6]){
                co[n]==co[0];
            }
            if(n==6){
                n=0;
            }
          },2000);
        
}
function but(r){
    let p=document.getElementById("img");
    let co=document.querySelectorAll(".diva");
    co[0].style="background-color: white;";
    co[1].style="background-color: white;";
    co[2].style="background-color: white;";
    co[3].style="background-color: white;";
    co[4].style="background-color: white;";
    co[5].style="background-color: white;";
    p.src="../images/q0"+r+".jpg";
    co[r-1].style="background-color: darkgray;";
    clearInterval(t);
    pic(r);
}
    // let a=["test1","test2","test3","test4","test5"];
    // for(let s in a){
    //     console.log(s);
    // }
